
import numpy as np
import random
import matplotlib.pyplot as plt
#x改成无约束形式及0-无穷


d11=3324.083
s11=577.682
y11=[]
#x11=np.arange(2065,5265,3.2)  
x11=np.arange(0,5500,5.5) 

d12=1319.925926
s12=499.031
y12=[]
#x12=np.arange(721,2570,1.849)  
x12=np.arange(0,5500,5.5)

d21=96.865
s21=14.696
y21=[]
#x21=np.arange(59,128,0.069)
x21=np.arange(0,255,0.255) 


d22=173.269
s22=8.862
y22=[]
#x22=np.arange(146,188,0.042) 
x22=np.arange(0,255,0.255)

for j in range(0,1000):
    if abs(d11-x11[j])>2*s11 :
        y11.append(0)
    else :
        y11.append(1-((x11[j]-d11)/(2*s11))**2)   
        
for j in range(0,1000):
    if abs(d12-x12[j])>2*s12 :
        y12.append(0)
    else :
        y12.append(1-((x12[j]-d12)/(2*s12))**2)   

for j in range(0,1000):
    if abs(d21-x21[j])>2*s21 :
        y21.append(0)
    else :
        y21.append(1-((x21[j]-d21)/(2*s21))**2)

for j in range(0,1000):
    if abs(d22-x22[j])>2*s22 :
        y22.append(0)
    else :
        y22.append(1-((x22[j]-d22)/(2*s22))**2)  

plt.rcParams['font.sans-serif']=['STSong']     # 中文宋体
plt.rcParams['font.size'] = '15' # 设置字体大小 
plt.figure('area db_1', figsize=(8, 8))

'''
plt.plot(x11,y11, c='green',label="$y^1(x_1)$")
plt.plot(x12,y12, color='red', label="$y^2(x_1)$",linestyle="--")
plt.legend()
plt.xlabel("轮廓面积",fontsize=20)
plt.ylabel("$y$",fontsize=20)
plt.grid(linestyle=":", color="black")

'''


plt.plot(x21,y21, color='green', label="$y^1(x_2)$")
plt.plot(x22,y22, color='red', label='$y^2(x_2)$',linestyle="--")
plt.legend()
plt.xlabel("灰度均值",fontsize=20)
plt.ylabel("$y$",fontsize=20)










plt.grid(linestyle=":", color="black")
plt.show()  #绘制图像



